Filter out extension-related operations in creation scripts of history table#3713
Conversation
…to prevent superuser permission errors and add related test.
|
@roji Is the approach in this PR something you would consider merging? Of course, |
79fae3a to
f894de9
Compare
75c2ea9 to
d038259
Compare
|
Hi @roji, just a friendly ping on this; would love to hear your thoughts when you get a chance 😅 I'm happy to adjust the approach or add anything if needed! |
|
@dkottis thanks and sorry once again this took so long to review. The overall idea seems correct - we were already trying to filter out all enums and extensions from the migration history table creation (#3329). However, the approach used there - which is also the approach of EF itself - is to selectively remove specific conventions which are known to add unwanted database objects. That approach breaks down with the NpgsqlNetTopologySuiteExtensionAddingConvention adds by the NetTopologySuite plugin - that's the source of the problem here. So rather than add another specific hack to remove migration operations with extension-related operations, I pushed a commit to only look at migration operations, and no longer look at the conventions producing them; this is more general and targets the specific problematic thing. I'll also note that your PR filtered out AlterDatabaseOperations the moment they had a single extension-related annotation; that's unsafe, since there could be other annotations on the same operation that isn't related to extensions. Check out the commit I pushed to see the new approach. |
|
Backported to 10.0.2 via a360244 |
Some Managed PostgreSQL services (e.g., Azure Flexible Server) do not grant users permission to create extensions, just superusers. Previously, when extensions like NetTopologySuite were configured, efcore.pg would include
CREATE EXTENSION IF NOT EXISTS postgis;in every GetCreateScript() initialization script on startup, which then would break the application because of this permission error.This PR adds a workaround to filter out extension-related operations from the creation scripts of the history table.
Fixes #3496